package lab_3;

import org.omg.CORBA.ORB;
import java.util.Date;
/*
 * C:\Program Files\Java\jdk1.6.0_24\bin\idlj.exe -fall -td
 * "C:\Users\Shadownest\Documents\NetBeansProjects\Lab_3\trunk\Lab_3\src"
 * "C:\Users\Shadownest\Documents\NetBeansProjects\Lab_3\trunk\Lab_3\src\lab_3\HotelOperatorContingent.idl"
 *
 * @author grp02 - Pascal Charreix and Meike Paetz
 *
 * This is the hotel operator contingent servant extending the HotelOperatorContingentPOA.
 */

public class HotelOperatorContingentServant extends HotelOperatorContingentPOA {

    private ORB orb = null;
    private int id;
    private String countryName;
    private String hotelName;
    private int singleRoom;
    private int familyRoom;
    private Date timePeriode;

    /**
     *
     * This is the constructor
     */
    public HotelOperatorContingentServant(int ID, String country, String hotel, int single, int family, int periode) {
        id = ID;
        countryName = country;
        hotelName = hotel;
        singleRoom = single;
        familyRoom = family;
        timePeriode = new Date(periode);
    }

    /**
     *
     * This is to get the ID
     */
    public int getId() {
        return id;
    }

    /**
     *
     * This is to get the country name
     */
    public String getCountryName() {
        return countryName;
    }

    /**
     *
     * This is to get the hotel name
     */
    public String getHotelName() {
        return hotelName;
    }

    /**
     *
     * This is the get the time periode
     */
    public String getTimePeriode() {
        return timePeriode.toString();
    }

    /**
     *
     * This is to get the day of the periode
     */
    public int getPeriodeDay() {
        return Integer.decode(timePeriode.toString().substring(8, 10));
    }

    /**
     *
     * This is to get the month of the periode
     */
    public String getPeriodeMonth() {
        return timePeriode.toString().substring(4, 7);
    }

    /**
     *
     * This is to get the year of the periode
     */
    public int getPeriodeYear() {
        return Integer.decode(timePeriode.toString().substring(24, 28));
    }

    /**
     *
     * This is to get single room
     */
    public int getSingleRoom() {
        return singleRoom;
    }

    /**
     *
     * This is to get family room
     */
    public int getFamilyRoom() {
        return familyRoom;
    }

    /**
     *
     * This is to set the ORB
     */
    public void setORB(ORB orb_val) {
        orb = orb_val;
    }

    /**
     *
     * This is to shut down the ORB when it is needed any more
     */
    public void shutdown() {
        if (orb != null) {
            System.out.println("Shutting down ORB ...");
            orb.shutdown(false);
        }
    }
}
